package com.css.fxfzysx.constants;

import com.css.fxfzysx.base.exception.ParamException;
import com.css.fxfzysx.util.PlatformObjectUtils;

import java.util.TreeMap;

public enum Src4Enum {
    A6("amax6", 0.05),
    A7("amax7", 0.1),
    A8("amax8", 0.2),
    A9("amax9", 0.4),
    A10("amax10", 0.8),
    //钢筋牌号
    H235("HPB235", 235),
    H335("HRB335", 335),
    H400("HRB400", 400),
    HPB335("HPB335",335),
    HPB300("HPB300",300),
    HRB335("HRB335",335),
    HRBF335("HRBF335",335),
    HRB400("HRB400",400),
    HRBF400("HRBF400",400),
    RRB400("RRB400",400),
    HPB500("HPB500",500),
    HRBF500("HRBF500",500),

    //混凝土强度等级
    CK13("C13", 8.7),
    CK15("C15", 10),
    CK18("C18", 12.1),
    CK20("C20", 13.5),
    CK23("C23", 15.4),
    CK25("C25", 17.0),
    CK28("C28", 18.8),
    CK30("C30", 20),
    CK35("C35", 23.5),
    CK40("C40", 27.0),
    CK45("C45", 29.5),
    CK50("C50", 32.0),
    CK55("C55", 34),
    CK60("C60", 36),

    //ξbk   —相对界限受压区高度
    BK6("HPB",0.6),
    BK5("HRB",0.55),
    JZGF2("②符合标准Tj 11-1978要求",0.2),
    JZGF1("①符合《建筑抗震设计规范》（GBJ 11-89）",0.1),
    JZGF3("③符合标准Tj 11-1974要求，但不符合② ",0.3),
    JZGF4("④符合《建筑抗震设计规范》（GB50011）",0.4),
    JZGF5("其他",0.5);





    private String code;

    private double index;


    Src4Enum(String code, double index) {
        this.index = index;
        this.code = code;
    }

    private static final TreeMap<String, Src4Enum> B_SRC_ENUM_TREE_MAP = new TreeMap<>();


    static {
        for (Src4Enum src4Enum : Src4Enum.values()) {
            B_SRC_ENUM_TREE_MAP.put(src4Enum.code, src4Enum);
        }
    }

    public static Double getBycode(String code) {
        if (PlatformObjectUtils.isEmpty(B_SRC_ENUM_TREE_MAP.get(code))) {
            throw new ParamException("所选参数未在定义范围内，请联系管理员！");
        }
        return B_SRC_ENUM_TREE_MAP.get(code).getIndex();
    }
    public void setCode(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public double getIndex() {
        return index;
    }

    public void setIndex(double index) {
        this.index = index;
    }

}
